<!DOCTYPE HTML>
<html lang="utf-8">
<head>
<meta charset="utf-8">
<title>驾车宝典-群组详细页</title>
<link href="${ctx}/styles/group.css" rel="stylesheet" type="text/css">
<#include '/baseHead.ftl'>
<!--	@RequestMapping(value="/detail/{id}-{pageNumber}-{orderBy}")-->
<#macro groupDetailPageLink  groupId,pageNumber,orderBy>${ctx}/group/detail/d/${group.groupId?c}-${pageNumber}-${orderBy}</#macro>
<!--主要部分开始-->
<section id="main"><div class="bgA_01">
	
	<!--左边开始-->
	<div id="leftArea"> 
		<div class="groupInfoPanel_01"><div class="bgP_01">
			<div class="imgField">
				<div class="img">
					<span><img src="${group.image!}" width="80" height="80" alt="人生和信念"></span>
				</div>
				<div class="btns">
				  <#if isMaster>
					 <a href="#" class="btn">管理小组</a>
				  <#else>
				  	<#if isLogin>
				  			<#if isGroupMember>
				  				 <span id="ospan"><a href="javascript:exitGroup();" class="btn"  style="color:gray">-退出小组</a></span>
				  			<#else>
				  				 <span id="ospan"><a href="javascript:joinGroup()" class="btn" >+加入小组</a></span>
				  			</#if>
				  		</#if>
				  </#if>
				</div>
			</div>
			<div class="infoField">
				<h1>${group.groupName!}</h1>
				<p class="url">http://www.take365.com/group/${group.groupId?c}</p>
				<p>创建于：${group.createDate?date}</p>
				<p >成员数：<span  id="mspan">${group.memberCount?c}</span>人</p>
			</div>
			<div class="textField">
				${group.groupDesc!}
			</div>
		</div></div>
		
		<div class="nTabPanel_01"><div class="bgP_01">
			<div class="btnField">
				<#if isLogin>
				<a href="${ctx}/topic/intocreatetopic/${group.groupId?c}" class="btn btn1">发表话题</a>
				<a href="${ctx}/topic/intocreateactivity/${group.groupId?c}" class="btn btn2">发表活动</a>
				</#if>
			</div>
			<nav class="menuField">
				<ul>
					<li><a <#if type=='topic'> class="on"</#if> href="<@groupDetailLink groupId="${group.groupId?c}"/>" title="讨论区">讨论区</a></li>
					<li><a <#if type=='activity'> class="on"</#if> href="<@groupActivityLink groupId="${group.groupId?c}" pageNumber="1"/>" title="活动区">活动区</a></li>
					<!--<li><a href="#" title="小组成员">小组成员</a></li>-->
					<#if isMaster ><li><a href="#" title="小组管理">小组管理</a></li></#if>
				</ul>
			</nav>
		</div></div>
		
		<div class="<#if type =='topic'>invitationPanel_02</#if><#if type='activity'>activityPanel_02</#if>">
			<#if type =='topic'>
			<div class="listField">
				<dl>
					<dt>
						<p class="info1">话题</p>
						<p class="info2">小组</p>
						<p class="info3">作者</p>
						<p class="info4">回复/查看</p>
						<p class="info5">最后回应</p>
					</dt>
					<#list fullSiteTopList as topic>
					<dd>
						<p class="info1"><a href="<@topicDetailLink topicId="${topic.topicId?c}"/>"><b>[全站置顶]&nbsp;</b>${topic.topicTitleAfterFilter!}</a></p>
						<p class="info2"><a href="<@topicDetailLink topicId="${topic.topicId?c}"/>">${topic.groupName!}</a></p>
						<p class="info3"><a href="<@userCenterLink memberId="${topic.fkCreateMemberId?c}"/>">${topic.createMemberName!}</a><span>${topic.createDate?date}</span></p>
						<p class="info4">${topic.replyCount!}/${topic.clickCount!}</p>
						<p class="info5">
							 <#if topic.lastReplyMemberId?exists>
							<a href="<@userCenterLink memberId="${topic.lastReplyMemberId?c}"/>">${topic.lastReplyMemberName!}</a>
							<span><#if topic.lastReplyDate?exists>${ topic.lastReplyDate?date}<#else></#if></span>
							<#else>
								<span>暂无回复</span>
							</#if>
						
						</p>
					</dd>
					</#list>
					<#list cateGoryTopList as topic>
					<dd>
						<p class="info1"><a href="<@topicDetailLink topicId="${topic.topicId?c}"/>"><b>[分类置顶]&nbsp;</b>${topic.topicTitleAfterFilter!}</a></p>
						<p class="info2"><a href="<@topicDetailLink topicId="${topic.topicId?c}"/>">${topic.groupName!}</a></p>
						<p class="info3"><a href="<@userCenterLink memberId="${topic.fkCreateMemberId?c}"/>">${topic.createMemberName!}</a><span>${topic.createDate?date}</span></p>
						<p class="info4">${topic.replyCount!}/${topic.clickCount!}</p>
						<p class="info5">
							 <#if topic.lastReplyMemberId?exists>
							<a href="<@userCenterLink memberId="${topic.lastReplyMemberId?c}"/>">${topic.lastReplyMemberName!}</a>
							<span><#if topic.lastReplyDate?exists>${ topic.lastReplyDate?date}<#else></#if></span>
							<#else>
								<span>暂无回复</span>
							</#if>
						
						</p>
					</dd>
					</#list>
					<#list groupTopList as topic>
					<dd>
						<p class="info1"><a href="<@topicDetailLink topicId="${topic.topicId?c}"/>"><b>[组内置顶]&nbsp;</b>${topic.topicTitleAfterFilter!}</a></p>
						<p class="info2"><a href="<@topicDetailLink topicId="${topic.topicId?c}"/>">${topic.groupName!}</a></p>
						<p class="info3"><a href="<@userCenterLink memberId="${topic.fkCreateMemberId?c}"/>">${topic.createMemberName!}</a><span>${topic.createDate?date}</span></p>
						<p class="info4">${topic.replyCount!}/${topic.clickCount!}</p>
						<p class="info5">
							 <#if topic.lastReplyMemberId?exists>
							<a href="<@userCenterLink memberId="${topic.lastReplyMemberId?c}"/>">${topic.lastReplyMemberName!}</a>
							<span><#if topic.lastReplyDate?exists>${ topic.lastReplyDate?date}<#else></#if></span>
							<#else>
								<span>暂无回复</span>
							</#if>
						
						</p>
					</dd>
					</#list>
					<#list topicPage.result as topic>
					<dd>
						<p class="info1"><a href="<@topicDetailLink topicId="${topic.topicId?c}"/>">${topic.topicTitleAfterFilter!}</a></p>
						<p class="info2"><a href="<@topicDetailLink topicId="${topic.topicId?c}"/>">${topic.groupName!}</a></p>
						<p class="info3"><a href="<@userCenterLink memberId="${topic.fkCreateMemberId?c}"/>">${topic.createMemberName!}</a><span>${topic.createDate?date}</span></p>
						<p class="info4">${topic.replyCount!}/${topic.clickCount!}</p>
						<p class="info5">
							 <#if topic.lastReplyMemberId?exists>
							<a href="<@userCenterLink memberId="${topic.lastReplyMemberId?c}"/>">${topic.lastReplyMemberName!}</a>
							<span><#if topic.lastReplyDate?exists>${ topic.lastReplyDate?date}<#else></#if></span>
							<#else>
								<span>暂无回复</span>
							</#if>
						
						</p>
					</dd>
					</#list>
				</dl>
			</div>
			</#if>
			<#if type=='activity'>
				<div class="titleField">
				<p class="more"><em>报名中</em> | <span>已结束</span></p>
				<h1>活动介绍</h1>
				</div>
				<div class="listField">
				<ul>  
					<#list topicPage.result as topic>
						<li>
						<div class="btns">
							<a href="#" class="btn btn1" title="点击报名">报名人数<br>${topic.jionActivityMemberCount!}</a>
						</div>
						<div class="img">
							<a href="<@topicDetailLink topicId="${topic.topicId?c}" />" title="点击报名"><img src="${topic.picview!}" width="131" height="87" alt="微博转发 送罗莱千元儿童四件套"></a>
						</div>
						<div class="info">
							<h2><a href="<@topicDetailLink  topicId="${topic.topicId?c}"/>" title="点击报名">${topic.topicTitleAfterFilter!}</a></h2>
							<p>活动时间：${topic.startDate?date} 至 ${topic.endDate?date}</p>
							<p>活动发起：<a href="#" class="name" title="查看个人信息">${topic.createMemberName!}</a></p>
						</div>
						</li>
					</#list>
				</ul>
			</div>
			</#if>
			
			<div class="pageNumField">
				<p>
					<#if !topicPage.firstPage>
					<a href="<@groupDetailPageLink   groupId="${group.groupId?c}" pageNumber="0" orderBy="${orderBy}"  />">首页</a>
					</#if>
					<#if topicPage.hasPreviousPage>
					<a href="<@groupDetailPageLink   groupId="${group.groupId?c}" pageNumber="${pageNumber-1}" orderBy="${orderBy}"  />">上一页</a>
					</#if>
					<#list topicPage.getLinkPageNumbers() as item>
						<#if item_index==5>
							<#break>
						</#if>
						<#if item == topicPage.thisPageNumber>
							<a href="javascript:;" class="on">${item}</a>
						<#else>
								<a href="<@groupDetailPageLink   groupId="${group.groupId?c}" pageNumber="${item}" orderBy="${orderBy}"  />">${item}</a>
						</#if>
					</#list>
					<#if topicPage.hasNextPage>
					<a href="<@groupDetailPageLink   groupId="${group.groupId?c}" pageNumber="${pageNumber+1}" orderBy="${orderBy}"  />">下一页</a>
					</#if>
					<#if !topicPage.lastPage>
					<a  href="<@groupDetailPageLink   groupId="${group.groupId?c}" pageNumber="${topicPage.lastPageNumber?c}" orderBy="${orderBy}"  />">末页</a>
					</#if>
				</p>
			</div>
		</div>
	
	</div>
	<!--左边结束-->
	
	<!--右边开始-->
	<div id="rightArea">
		
			<#if isLogin>
					<#include  '/common/memberInfo.ftl' >
			<#else>
					<#include  '/common/rightMemberInfo.ftl' >
			</#if>
			<#if isLogin>
					<#include  '/common/rightGroup.ftl' >
			</#if>
		
		<div class="topicPanel_01">
			<div class="titleField titleType_01">
				<h1>推荐话题</h1>
			</div>
			<div class="listField">
				<ul>
					<#list topicList as topic>
					<li>
						<div class="img">
							<a href="<@topicDetailLink  topicId="${topic.topicId?c}"/>" title="查看详情"><img src="${topic.picview!}" width="50" height="50" alt="${topic.topicTitleAfterFilter!}"></a>
						</div>
						<div class="info">
							<h2><a href="<@topicDetailLink  topicId="${topic.topicId?c}"/>" title="查看详情">${topic.topicTitleAfterFilter!}</a></h2>
							<p>来自 <a class="name" href="#" title="查看个人信息">${topic.createMemberName!}</a></p>
						</div>
					</li>
					</#list>
				</ul>
			</div>
		</div>
		
		<div class="memberPanel_01">
			<div class="titleField titleType_01">
				<h1>最新加入</h1>
			</div>
			<div class="listField">
				<ul>
					<#list  memberList as member>
					<li>
						<div class="img">
							<a href="<@userCenterLink memberId="${member.memberId}" />" title="查看个人信息"><img src="${member.headImage!}" width="60" height="60" alt="姬十三"></a>
						</div>
						<div class="info">
							<p class="btns" id="member${member.memberId?c}">
								<#if isLogin && ( SESSION_MEMBER_KEY.memberId!=member.memberId)>
									<#if member.focusDate?exists>
											<a href="javascript:deleteFocus(${member.memberId?c})" class="btn btn1" title="取消关注">- 取消关注</a>
									<#else>
											<a href="javascript:focus(${member.memberId?c})" class="btn btn1" title="加关注">+ 关注</a>
									</#if>
								
							    </#if>
							</p>
							<h2><a class="name" href="<@userCenterLink memberId="${member.memberId}" />" title="${member.nickName!}">
							<#if  (member.nickName?length > 6 )>${member.nickName?substring(0,6)}
							<#else>
								${member.nickName!}
							</#if></a></h2>
							<p style='overflow:hidden;height:24px;line-height:24px;'>${member.signature!}</p>
						</div>
					</li>
					</#list>
				</ul>
			</div>
		</div>
		
		<div class="groupPanel_03">
			<div class="titleField titleType_01">
				<h1>相关小组</h1>
			</div>
			<div class="listField">
				<ul>
					<#list sameCateGroupList as group >
					<li>
						<div class="img">
							<a href="<@groupDetailLink groupId="${group.groupId}" />" title="查看详情"><img src="${group.image}" width="80" height="80" alt="雪佛兰试驾会召集"></a>
						</div>
						<div class="info">
							<h2><a href="<@groupDetailLink groupId="${group.groupId}" />" title="查看详情">${group.groupName}</a></h2>
							<p ><span>${group.memberCount?c}</span>成员 / ${group.totalTopicCount?c}话题</p>
						</div>
					</li>
					</#list>
				</ul>
			</div>
		</div>
		
	</div>
	<!--右边结束-->

	
	<#include '/commonFriendLink.ftl'>

</div></section>
<!--主要部分结束-->
<#include '/baseFoot.ftl'>
<script>
	function joinGroup(){
			$.ajax({
		 			type: "get",
					url: "${ctx}/group/join/${group.groupId?c}",
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						var state = data.state;
						if ( state == 1 ){
							  	$('#ospan').html("<a href='javascript:exitGroup();' class='btn'  style='color:gray'>- 退出小组</a>");
							  	$('#mspan').html(data.memberCount);
						}else{
							desc = data.desc;
							alert(desc);
						}
					},
					data:{
					},
					dataType:'json'
				}
	 		)
	}
	function exitGroup(){
			$.ajax({
		 			type: "get",
					url: "${ctx}/group/exit/${group.groupId?c}",
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						var state = data.state;
						if ( state == 1 ){
							$('#ospan').html("<a href='javascript:joinGroup();' class='btn' style='color:red'>+ 加入小组</a>");
							$('#mspan').html(data.memberCount);
						}else{
							desc = data.desc;
							alert(desc);
						}
					},
					data:{
					},
					dataType:'json'
				}
	 		)
	}
	function focus(memberId){
			$.ajax({
		 			type: "get",
					url: "${ctx}/smgmemberfocus/focus/"+memberId,
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						var state = data.state;
						if ( state == 1 ){
							$('#member'+memberId).html("<a href='javascript:deleteFocus("+memberId+");' class='btn' style='color:red'>- 取消关注</a>");
						}else{
							desc = data.desc;
							alert(desc);
						}
					},
					data:{
					},
					dataType:'json'
				}
	 		)
	}
	function deleteFocus(memberId){
		$.ajax({
		 			type: "get",
					url: "${ctx}/smgmemberfocus/deleteFocus/"+memberId,
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						var state = data.state;
						if ( state == 1 ){
							$('#member'+memberId).html("<a href='javascript:focus("+memberId+");' class='btn btn1' style='color:red'>+ 关注</a>");
						}else{
							desc = data.desc;
							alert(desc);
						}
					},
					data:{
					},
					dataType:'json'
				}
	 		)
	}
</script>
</body>
</html>